import { flatMenus } from './menus'

// 获取实际存储的路由
export const realRoutes = flatMenus
  .filter(i => i.node && i.node.component)
  .map(i => ({
    path: i.node.name,
    name: i.node.name,
    meta: { title: i.node.title },
    component: i.node.component,
  }))

// console.log(realRoutes)

/**
 * 基础路由
 * @type { *[] }
 */
export const routes = [
  {
    path: '/',
    redirect: { path: '/home' },
    name: 'Root',
    children: [
      {
        path: 'home',
        name: 'home',
        component: () => import('@/views/home/index.vue'),
      },
      ...realRoutes,
    ],
  },
]
